package com.huaxin.hxmoduleworkorder.dto.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 更新巡查工单请求 DTO（包含 ID）
 * <p>
 * 对应实体类：InspectionOrder
 * 用于接收前端提交的巡查工单更新数据，包含主键 ID。
 * 适用于需要自包含请求体的更新场景。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
public class InspectionOrderUpdateReqDTO {
    @Schema(description = "ID，主键，用于定位更新目标", example = "ins_order_123")
    @NotBlank(message = "ID不能为空")
    private String id;

    @Schema(description = "标题", example = "月度客户用电安全巡检")
    @NotBlank(message = "标题不能为空")
    @Size(max = 100, message = "标题长度不能超过100个字符")
    private String title;

    @Schema(description = "描述", example = "对所有签约客户进行例行安全检查")
    @Size(max = 1000, message = "描述长度不能超过1000个字符")
    private String description;

    @Schema(description = "执行开始时间（可联系客户）", example = "2025-09-02T08:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime executeStartTime;

    @Schema(description = "执行截止时间（必须完成）", example = "2025-09-05T18:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime executeEndTime;

    @Schema(description = "负责电工ID", example = "e1001")
    @NotBlank(message = "负责电工ID不能为空")
    private String assignedElectricianId;


    @Schema(description = "负责电工名称", example = "张三")
    private String assignedElectricianName;

    @Schema(description = "涉及客户ID列表")
    @NotNull(message = "涉及客户ID列表不能为空")
    private List<InspectionOrderCustomerIdDTO> customers;

    @Schema(description = "使用的巡查模板ID", example = "tpl_ins_001")
    private String templateId;
}